//引入一堆
import Vue from 'vue';
import VueRouter from 'vue-router';
//主体
import App from './components/app.vue';
//路由切换页面
import header from './components/header.vue'
import header2 from './components/header2.vue'
import footer from './components/footer.vue'
import main from './components/main.vue'

//安装插件
Vue.use(VueRouter); //挂载属性

//创建路由对象并配置路由规则
let router = new VueRouter({
    //routes
    routes: [{
            path: '/page1',
            components: {
                header: header,
                default: main,
                footer: footer
            }
        },
        {
            path: '/page2',
            components: {
                header: header2,
                default: main,
                footer: footer
            }
        },

    ]
});






//new Vue 启动
new Vue({
    el: '#app',
    //让vue知道我们的路由规则
    router, //可以简写router
    render: c => c(App),
})